<template>
  <div>
    <Table :columns="columns12" :data="borrower.data">
      <template slot-scope="{ row, index }" slot="action">
        <router-link
            :to="{
        path: 'borrower/procession',
        params: {key:row},
        query: {
           key: row.id, // orderNum : this.searchData.orderNo
        }
    }">
          <a>记录</a>
        </router-link>
      </template>
    </Table>
    <br>
    <template>
      <div style="float: right">
        <Page :total="borrower.total" show-sizer show-elevator show-total
              @on-change="changePage" @on-page-size-change="changeSize"/>
      </div>
    </template>
  </div>
</template>

<script>
    import { CreateArticle } from '../../api/borrower';

    export default {
        name: 'table-list',

        data () {
            return {
                page: 1,
                pageSize: 10,
                columns12: [
                    {
                        title: '贷款产品',
                        key: 'productName'
                    },
                    {
                        title: '借方名称',
                        key: 'borrowerName'
                    },
                    {
                        title: '借方类型',
                        key: 'borrowerType'
                    },
                    {
                        title: '手机号码',
                        key: 'borrowerPhone'
                    },
                    {
                        title: '处理状态',
                        key: 'state',
                        maxWidth: 160
                    },
                    {
                        title: '操作',
                        slot: 'action',
                        width: 150,
                        align: 'center'
                    }
                ]

            }
        },
        methods: {
            getborrower () {
                CreateArticle({
                    page: this.page - 1,
                    pageSize: this.pageSize,
                    productName: this.productName
                })
                    .then(res => {
                        this.borrower = res;
                        console.log(res)
                        // 返回数据
                    })
                    .catch(err => {
                        console.log(err);
                        // 异常情况
                    })
            },
            changePage (currentPage) {
                this.page = currentPage;
                this.getborrower();
            },
            changeSize (currentSize) {
                this.pageSize = currentSize;
                this.getborrower()
            }
        },
        props: {
            borrower: Array,
            productName: String
        },
        created () {
        }
    }
</script>

<style scoped>
/deep/.ivu-tag-dot{
  border: none;
}
</style>
